package com.ashen.study.aop.chain;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ChainClient {
    static class ChainHandlerA extends ChainHandler{
        @Override
        protected void handlerProcess() {
            System.out.println("ChainHandler of A");
        }
    }
    static class ChainHandlerB extends ChainHandler{
        @Override
        protected void handlerProcess() {
            System.out.println("ChainHandler of B");
        }
    }

    static class ChainHandlerC extends ChainHandler{
        @Override
        protected void handlerProcess() {
            System.out.println("ChainHandler of C");
        }
    }

    public static void main(String[] args) {
        List<ChainHandler> chainHandlerList = Arrays.asList(
          new ChainHandlerA(),
          new ChainHandlerB(),
          new ChainHandlerC()
        );
        Chain chain = new Chain(chainHandlerList);
        chain.proceed();
    }
}
